package com.wyg.blog.controller.view_blog;

import com.alibaba.fastjson.JSON;
import com.wyg.blog.model.user.AuthorInformation;
import com.wyg.blog.service.user.AuthorInfoService;
import com.wyg.blog.utils.JsonResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @description:
 * @author: WYG
 * @time: 2021/1/29 22:45
 */
@RestController
@RequestMapping("/api/view/authorInfo")
public class ViewAuthorInfoController {
    @Resource
    AuthorInfoService authorInfoService;

    @GetMapping("/getInfo")
    @CrossOrigin
    public JsonResult<Map<String, String>> getAuthorInfo(@RequestParam("id") Integer id) {
        Map<String, String> authorInformation = authorInfoService.selectSomeInfo(id);
        return new JsonResult<>(authorInformation, "200","获取个人简介成功!");
    }

    @GetMapping("getContent")
    @CrossOrigin
    public JsonResult<String> getContent(@RequestParam("id") Integer id) {
        String content = authorInfoService.selectContent(id);
        return new JsonResult<>(content, "200", "获取个人信息成功!");
    }

}
